package bbs.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author ljg;
 * @create 2022-06-08 10:03
 */
public class Topic implements Serializable {
    /**
     * 主题id
     */
    private Integer topicId;

    /**
     * 所属板块的id
     */
    private Integer boardId;

    /**
     * 主题的标题
     */
    private String topicTitle;

    /**
     * 用户id，哪个用户发布的
     */
    private Integer userId;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 最后回复时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastPost;

    /**
     * 访问数量
     */
    private Integer topicView;

    /**
     * 回复数
     */
    private Integer topicReplies;

    /**
     * 是否是一个精华帖：0不是；1是
     */
    private Integer digest;

    /**
     * 当前 topic 的所属板块
     */
    private Board board ;

    /**
     * 当前 topic 所属用户
     */
    private User user ;

//    @Override
//    public String toString() {
//        return "Topic{" +
//                "topicId=" + topicId +
//                ", boardId=" + boardId +
//                ", topicTitle='" + topicTitle +
//                ", userId=" + userId +
//                ", createTime=" + createTime +
//                ", lastPost=" + lastPost +
//                ", topicView=" + topicView +
//                ", topicReplies=" + topicReplies +
//                ", digest=" + digest +
//                '}';
//    }

    public Integer getTopicId() {
        return topicId;
    }

    public void setTopicId(Integer topicId) {
        this.topicId = topicId;
    }

    public Integer getBoardId() {
        return boardId;
    }

    public void setBoardId(Integer boardId) {
        this.boardId = boardId;
    }

    public String getTopicTitle() {
        return topicTitle;
    }

    public void setTopicTitle(String topicTitle) {
        this.topicTitle = topicTitle;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getLastPost() {
        return lastPost;
    }

    public void setLastPost(LocalDateTime lastPost) {
        this.lastPost = lastPost;
    }

    public Integer getTopicView() {
        return topicView;
    }

    public void setTopicView(Integer topicView) {
        this.topicView = topicView;
    }

    public Integer getTopicReplies() {
        return topicReplies;
    }

    public void setTopicReplies(Integer topicReplies) {
        this.topicReplies = topicReplies;
    }

    public Integer getDigest() {
        return digest;
    }

    public void setDigest(Integer digest) {
        this.digest = digest;
    }

    public Board getBoard() {
        return board;
    }

    public void setBoard(Board board) {
        this.board = board;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
}